#!/bin/bash

if test -z $1 || test -z $2 || test -z $3 ;then
    echo "usage:./$0 [platform] [app version] [project name]"
    exit 0
fi

PLATFORM=$1
APP_VERSION=$2
PROJECT_NAME=$3

echo "platform:$2"
echo "app version:$3"
echo "app version:$4"

if ! test -d build;then
    mkdir build 
fi

cd build

if test -f CMakeCache.txt;then
    rm CMakeCache.txt
fi

cmake .. -DPLATFORM=$PLATFORM -DVERSION=$APP_VERSION -DPROJECT=$PROJECT_NAME

# 编译打包
cmake --build . --target package

curDate=$(date "+%Y-%m-%d")

cp package/$PROJECT_NAME.tar.gz package/${PROJECT_NAME}_2_${APP_VERSION}.tar.gz

#make clean -C ../makefile/euler
# 打包源代码
#cmake --build . --target package_source
